﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace Mpfr.Structs
{
  public unsafe class mpz_t : IDisposable
  {
    internal __mpz_struct* mpz_ptr;

    public mpz_t()
    {
      mpz_ptr = (__mpz_struct*)Marshal.AllocHGlobal(sizeof(__mpz_struct));
    }

    ~mpz_t()
    {
      Dispose();
    }

    public void Dispose()
    {
      if (mpz_ptr != null)
      {
        Marshal.FreeHGlobal((IntPtr)mpz_ptr);
        mpz_ptr = null;
      }
    }
  }
}
